package flater.cairngormtips.controller.delegates
{
import flater.cairngormtips.model.vo.Item;
import flater.cairngormtips.util.out;
	
public class ExampleDataTranslator
{

    public static function ParseItems( itemsXML : XMLList ) : Array
    {
        out( "ExampleDataTranslator.ParseItems() invoked" );
             
    	var items : Array = [];
    	
    	for each ( var itemNode : XML in itemsXML )
    	{
    	   items.push( ParseItem( itemNode ) );	
    	}
    	
    	return items;
    }
    
    public static function ParseItem( itemXML : XML ) : Item
    {
        out( "ExampleDataTranslator.ParseItem() invoked" );

    	var item : Item    = new Item();
            item.created   = new Date( 
                                int( itemXML.@created.toString() ) );
            item.id        = itemXML.@id.toString();
            item.name      = itemXML.name.toString();
            item.value     = itemXML.value.toString(); 
    	
    	return item;
    }
    

} //  end class
} //  end package